'use strict';
import React, {PropTypes} from 'react';
import {
    View,
    Image,
    Text,
    StyleSheet,
} from 'react-native';
import Global from '../Commom/GlobalConst';

const styles = StyleSheet.create({
    container: {
        flex: 1,
        flexDirection: 'row',
        marginTop: 5,
        width: Global.Const.size.width - 120,
    },
    Image: {
        width: 13,
        height: 13,
        marginRight: 3
    },
    text: {
        flex: 1,
        fontSize: 12,
        marginRight: 3,
        color: Global.FontColor.DarkGray,
    }
});

let images = [
    require('../../Image/icon_eat.png'),
    require('../../Image/icon_play.png'),
    require('../../Image/icon_live.png'),
];

class RoomEatPlay extends React.Component {

    render() {
        let {typeText} = this.props;
        return (
            <View style={styles.container}>
                {
                    typeText ? typeText.map((item, index)=> {
                        return (
                            <View key={'item' + index}
                                  style={{
                                      flexDirection: 'row',
                                      flex: 1,
                                      alignItems: 'center',
                                  }}
                            >
                                <Image source={images[index]}
                                       style={styles.Image}/>
                                <Text numberOfLines={1} style={styles.text}>{item}</Text>
                            </View>
                        )
                    }) : null
                }
            </View>

        )
    }
}

RoomEatPlay.PropTypes = {
    typeText: PropTypes.array.isRequired,
};

export default RoomEatPlay;